
package com.exteam.common.vo;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.io.Serializable;
import java.util.List;


/**
 * 商品接口
 *
 * @author sean.yanghy
 * @version v1.0
 * @created 2014-11-21
 */
public abstract class BaseInfo<T> implements Serializable {

    public abstract T parseJSONObject(String jsonString);

    //{

		/*
		try {
			JSONObject o = new JSONObject(jsonString);
			GoodsInfo info = new GoodsInfo();
			info.name = o.optString("name");
			info.commodityId = o.optString("commodityId");
			info.type = o.optString("type");
			info.referencePrice = o.optDouble("referencePrice");
			info.currentPrice = o.optDouble("currentPrice");
			info.imageUrl = o.optString("imageUrl");
			info.title = o.optString("title");
			info.description = o.optString("description");
			info.sold = o.optInt("sold");
			return info;
		} catch (JSONException e) {
			Logger.e(GoodsInfo.class.getSimpleName(), e);
			return null;
		}
		*/
    //}


    public abstract JSONObject toJSONObject() throws JSONException;

    //{
		/*
		JSONObject o = new JSONObject();
		try {
			o.put("name", name);
			o.put("commodityId", commodityId);
			o.put("type", type);
			o.put("referencePrice", referencePrice);
			o.put("currentPrice", currentPrice);
			o.put("imageUrl", imageUrl);
			o.put("title", title);
			o.put("description", description);
			o.put("sold", sold);
			return o;
		} catch (JSONException e) {
			Logger.e(GoodsInfo.class.getSimpleName(), e);
			return null;
		}
		*/
    //}
    public T parseJSONObject(JSONObject jsonObj) throws JSONException {
        return null;
    }

    public List<T> parseJSONObject(JSONArray jsonArray) throws JSONException {
        return null;
    }


}

